<%-- 
    Document   : error
    Created on : Oct 6, 2012, 5:54:53 PM
    Author     : natz
--%>

<%@page import="com.myapp.actions.user.ListUsers"%>
<%@page import="com.myweb.MyWeb"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="mw" uri="/WEB-INF/tlds/myweb" %>
<mw:action action="<%=new ListUsers()%>" result="result"/>
<c:choose>
  <c:when test="${result.size() > 0}" >
    <table id="visit-list" class="table table-bordered table-hover">
      <tr class="header-row">
        <th>User ID</th>
        <th>Username</th>
        <th>Password</th>
        <th>Roles</th>
      </tr>
      <c:forEach items="${result}" var="user">
        <tr data-id="${user.id}">
          <td>${user.id}</td>
          <td>${user.username}</td>
          <td>${user.password}</td>
          <td>
            <c:forEach var="role" items="${user.roles}" varStatus="st">
              ${role}<c:if test="${!st.last}">, </c:if>
            </c:forEach>
          </td>
        </tr>
      </c:forEach>
    </table>
  </c:when>
  <c:otherwise>
    <div class="alert">
      <button type="button" class="close" data-dismiss="alert">×</button>
      <strong>Warning!</strong> No data
    </div>
  </c:otherwise>
</c:choose>

